﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RATSharp.Model
{
    /// <summary>
    /// Period model
    /// </summary>
    public class Period
    {
        /// <summary>
        /// Period id
        /// </summary>
        public int? id { get; set; }
        /// <summary>
        /// Period from date
        /// </summary>
        public DateTime fromDate { get; set; }
        /// <summary>
        /// Period to date
        /// </summary>
        public DateTime toDate { get; set; }
        /// <summary>
        /// Periods pickAction
        /// </summary>
        public PickAction pickAction { get; set; }
        /// <summary>
        /// Periods return action
        /// </summary>
        public ReturnAction returnAction { get; set; }
        /// <summary>
        /// is period valid
        /// </summary>
        public bool valid { get; set; }
        /// <summary>
        /// periods reservation
        /// </summary>
        public Reservation reservation {get; set; }


        /// <summary>
        /// overriden for properties visibility
        /// </summary>
        /// <returns>string representation</returns>
        public override string ToString()
        {
            string fromDateAsTime = String.Format("{0:dd.MM. HH:mm}", fromDate);
            string toDateAsTime = String.Format("{0:dd.MM. HH:mm}", toDate);
            return String.Format("Id: {0}, From: {1}, To: {2}, Owner: {3}, PickAction: {4}, ReturnAction: {5}, ObjectName: {6} , Valid: {7}", id, fromDateAsTime, toDateAsTime, reservation.userName, pickAction, returnAction, reservation.objectName, valid);
        }
    }

    /// <summary>
    /// This enum represents objects life cycle. It is placed here because it´s related to every single period.
    /// This is requested in "sliding window time" pickup feature
    /// </summary>
    public enum PickAction {
        /// <summary>
        /// object is not pickable
        /// </summary>
        NOT_PICKABLE,
        /// <summary>
        /// object is not picked yet
        /// </summary>
        NOT_PICKED,
        /// <summary>
        /// object is already picked
        /// </summary>
        PICKED};

    /// <summary>
    /// This enum represents objects life cycle. It is placed here because it´s related to every single period.
    /// This is requested in "sliding window time" pickup feature
    /// </summary>
        public enum ReturnAction {
        /// <summary>
        /// object is already returned
        /// </summary>
        RETURNED,
        /// <summary>
        /// object is not returned
        /// </summary>
        NOT_RETURNED,
                    /// <summary>
        /// not returnable object
        /// </summary>
        NOT_RETURNABLE
        };
}
